const tenantConfig = {
  1: {
    VUE_APP_CENTER_PATH: {
      stage: '"http://xxx.com/"',
      simulate: '"http://xxx.com/"',
      prod: '"http://xxx.com/"',
    },
    VUE_APP_INSTANCE_ID: '"aotu"',
  },
  132: {
    VUE_APP_CENTER_PATH: {
      stage: '"http://xxx.com/"',
      simulate: '"http://xxx.com/"',
      prod: '"http://xxx.com/"',
    },
    VUE_APP_INSTANCE_ID: '"aotu"',
  },
};
// npm 模式， npm run dev --tenantid=1
let tenantId = process.env.npm_config_tenantid;
// yran 模式, yarn run --tenantid=1 dev
if (!tenantId && process.env.npm_config_argv) {
  tenantId = JSON.parse(process.env.npm_config_argv)?.original?.[1]?.split(
    "="
  )?.[1];
}
console.log(tenantId);
let obj = tenantConfig[tenantId ?? "1"];
if (!obj) {
  throw new Error("请配置对应租户数据");
} else {
  for (const key of Object.keys(obj)) {
    if (typeof obj[key] === "object") {
      obj[key] = obj[key][process.env.NODE_ENV];
    }
  }
}
console.log(obj);
module.exports = { ...obj, VUE_APP_TENANT_ID: `'${tenantId}'` };
// export default { ...obj, VUE_APP_TENANT_ID: `'${tenantId}'` };
